home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / Container / Sources / Content.cpp < prev    next >
Encoding:
Text File  |  1996-09-17  |  20.6 KB  |  693 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                Content.cpp
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #include "Container.hpp"
  11.  
  12. #ifndef CONTENT_H
  13. #include "Content.h"
  14. #endif
  15.  
  16. #ifndef PART_H
  17. #include "Part.h"
  18. #endif
  19.  
  20. #ifndef SELECT_H
  21. #include "Select.h"
  22. #endif
  23.  
  24. // ----- Part Layer -----
  25.  
  26. #ifndef FWUTIL_H
  27. #include "FWUtil.h"
  28. #endif
  29.  
  30. #ifndef FWPRESEN_H
  31. #include "FWPresen.h"
  32. #endif
  33.  
  34. #ifndef FWFCTCLP_H
  35. #include "FWFctClp.h"
  36. #endif
  37.  
  38. #ifndef FWKIND_H
  39. #include "FWKind.h"
  40. #endif
  41.  
  42. // ----- OS Layer -----
  43.  
  44. #ifndef FWRECT_H
  45. #include "FWRect.h"
  46. #endif
  47.  
  48. #ifndef FWODGEOM_H
  49. #include "FWODGeom.h"
  50. #endif
  51.  
  52. #ifndef FWSUSINK_H
  53. #include "FWSUSink.h"
  54. #endif
  55.  
  56. #ifndef FWBARRAY_H
  57. #include "FWBArray.h"
  58. #endif
  59.  
  60. // ----- Foundation Layer -----
  61.  
  62. #ifndef FWSTREAM_H
  63. #include "FWStream.h"
  64. #endif
  65.  
  66. #ifndef FWSUSINK_H
  67. #include "FWSUSink.h"
  68. #endif
  69.  
  70. #ifndef FWMEMORY_H
  71. #include "FWMemory.h"
  72. #endif
  73.  
  74. // ----- OpenDoc Includes -----
  75.  
  76. #ifndef SOM_Module_OpenDoc_StdProps_defined
  77. #include <StdProps.xh>
  78. #endif
  79.  
  80. #ifndef SOM_ODShape_xh
  81. #include <Shape.xh>
  82. #endif
  83.  
  84. #ifndef SOM_ODStorageUnit_xh
  85. #include <StorageU.xh>
  86. #endif
  87.  
  88. //========================================================================================
  89. // Runtime Information
  90. //========================================================================================
  91.  
  92. #ifdef FW_BUILD_MAC
  93. #pragma segment odfcontainer
  94. #endif
  95.  
  96. FW_DEFINE_AUTO(CBaseContent)
  97. FW_DEFINE_AUTO(CPartContent)
  98. FW_DEFINE_AUTO(CSelectionContent)
  99. FW_DEFINE_AUTO(CUndoContent)
  100. FW_DEFINE_AUTO(CContentProxyIterator)
  101.  
  102. //========================================================================================
  103. //    class CBaseContent
  104. //========================================================================================
  105.  
  106. //----------------------------------------------------------------------------------------
  107. //    CBaseContent::CBaseContent
  108. //----------------------------------------------------------------------------------------
  109. //    CBaseContent constructor
  110.  
  111. CBaseContent::CBaseContent(Environment* ev, CContainerPart* part) :
  112.     FW_CEmbeddingContent(ev, part),
  113.     fProxyList(NULL),
  114.     fContainerPart(part)
  115. {
  116.     fProxyList = FW_NEW(CProxyCollection, ());
  117.     
  118.     FW_END_CONSTRUCTOR
  119. }
  120.  
  121. //----------------------------------------------------------------------------------------
  122. //    CBaseContent::CBaseContent
  123. //----------------------------------------------------------------------------------------
  124.  
  125. CBaseContent::CBaseContent(Environment* ev, CBaseContent* other) :
  126.     FW_CEmbeddingContent(ev, other->fContainerPart),
  127.     fProxyList(NULL),
  128.     fContainerPart(other->fContainerPart)
  129. {
  130.     fProxyList = FW_NEW(CProxyCollection, ());
  131.  
  132.     CContentProxyIterator ite(other);
  133.     for (CProxy* proxy = ite.First(); ite.IsNotComplete(); proxy = ite.Next())
  134.     {
  135.         this->AddProxy(ev, proxy);
  136.     }
  137.  
  138.     FW_END_CONSTRUCTOR
  139. }
  140.  
  141. //----------------------------------------------------------------------------------------
  142. //    CBaseContent::~CBaseContent
  143. //----------------------------------------------------------------------------------------
  144. //    CBaseContent destructor
  145.  
  146. CBaseContent::~CBaseContent()
  147. {
  148.     FW_START_DESTRUCTOR
  149.     delete fProxyList;
  150. }
  151.  
  152. //----------------------------------------------------------------------------------------
  153. //    CBaseContent::AddProxy
  154. //----------------------------------------------------------------------------------------
  155.  
  156. void CBaseContent::AddProxy(Environment* ev, CProxy* proxy)
  157. {
  158. FW_UNUSED(ev);
  159.     fProxyList->AddLast(proxy);
  160. }
  161.  
  162. //----------------------------------------------------------------------------------------
  163. //    CBaseContent::RemoveProxy
  164. //----------------------------------------------------------------------------------------
  165.  
  166. void CBaseContent::RemoveProxy(Environment* ev, CProxy* proxy)
  167. {
  168. FW_UNUSED(ev);
  169.     fProxyList->Remove(proxy);
  170. }
  171.  
  172. //----------------------------------------------------------------------------------------
  173. //    CBaseContent::CountProxies
  174. //----------------------------------------------------------------------------------------
  175.  
  176. unsigned long CBaseContent::CountProxies() const
  177. {
  178.     return fProxyList->Count();
  179. }
  180.  
  181. //----------------------------------------------------------------------------------------
  182. //    CBaseContent::GetFirstProxy
  183. //----------------------------------------------------------------------------------------
  184.  
  185. CProxy* CBaseContent::GetFirstProxy() const
  186. {
  187.     return fProxyList->First();
  188. }
  189.  
  190. //----------------------------------------------------------------------------------------
  191. //    CBaseContent::IsEmpty
  192. //----------------------------------------------------------------------------------------
  193.  
  194. FW_Boolean CBaseContent::IsEmpty() const
  195. {
  196.     return (fProxyList->Count() == 0);
  197. }
  198.  
  199. //----------------------------------------------------------------------------------------
  200. //    CBaseContent::CalcUpdateShape
  201. //----------------------------------------------------------------------------------------
  202.  
  203. ODShape* CBaseContent::CalcUpdateShape(Environment* ev)
  204. {
  205.     if (this->IsEmpty())
  206.         return NULL;
  207.  
  208.     ODShape* updateShape = ::FW_NewODShape(ev);
  209.  
  210.     FW_CAcquiredODShape aqTempShape = ::FW_NewODShape(ev);
  211.     FW_Boolean first = TRUE;
  212.  
  213.     CContentProxyIterator ite(this);
  214.     for (CProxy* proxy = ite.First(); ite.IsNotComplete(); proxy = ite.Next())
  215.     {
  216.         proxy->GetUpdateBox(ev, aqTempShape);
  217.         if (first)
  218.             updateShape->CopyFrom(ev, aqTempShape);
  219.         else
  220.             updateShape->Union(ev, aqTempShape);
  221.                         
  222.         first = FALSE;
  223.     }
  224.  
  225.     return updateShape;
  226. }
  227.  
  228. //----------------------------------------------------------------------------------------
  229. //    CBaseContent::RedrawProxies
  230. //----------------------------------------------------------------------------------------
  231.  
  232. void CBaseContent::RedrawProxies(Environment* ev)
  233. {
  234.     // Calculate the update shape and invalidate it
  235.     FW_CAcquiredODShape updateShape = CalcUpdateShape(ev);
  236.     if (updateShape != NULL)
  237.     {
  238.         // Invalidate the update shape
  239.         FW_CPresentation* presentation = fContainerPart->GetMainPresentation();
  240.         FW_CFacetClipper facetClipper;
  241.         facetClipper.Clip(ev, presentation, updateShape);
  242.         presentation->Invalidate(ev, updateShape);
  243.     }
  244. }
  245.  
  246. //----------------------------------------------------------------------------------------
  247. //    CBaseContent::PostInternalizeProxy
  248. //----------------------------------------------------------------------------------------
  249.  
  250. void CBaseContent::PostInternalizeProxy(Environment* ev, const FW_CPoint& offset, CProxy* proxy)
  251. {
  252. FW_UNUSED(ev);
  253. FW_UNUSED(offset);
  254. FW_UNUSED(proxy);
  255.     // Default is to do nothing
  256. }
  257.  
  258. //----------------------------------------------------------------------------------------
  259. //    CBaseContent::ExternalizeProxyList
  260. //----------------------------------------------------------------------------------------
  261.  
  262. void CBaseContent::ExternalizeProxyList(Environment* ev,
  263.                                         ODStorageUnit* storageUnit, 
  264.                                         FW_CCloneInfo* cloneInfo,
  265.                                         FW_Fixed offsetX,
  266.                                         FW_Fixed offsetY)
  267. {
  268.     // ----- Create an archive for our proxies -----
  269.     FW_PStorageUnitSink suSink(ev, storageUnit, kODPropContents, fContainerPart->GetPartKind(ev)->GetType(ev));
  270.     FW_CWritableStream archive(suSink);
  271.     
  272.     // ----- Write number of proxies -----
  273.     unsigned long count = fProxyList->Count();
  274.     archive << count;
  275.     
  276.     // ----- Write top, left offsets -----
  277.     archive << offsetX;
  278.     archive << offsetY;
  279.  
  280.     // ----- Write proxies -----
  281.     CProxyCollectionIterator ite(fProxyList);
  282.     FW_CRect frameRect;
  283.     for (CProxy* proxy = ite.First(); ite.IsNotComplete(); proxy = ite.Next())
  284.     {
  285.         FW_CRect bounds = proxy->GetBounds(ev);
  286.         archive << bounds;
  287.         proxy->Externalize(ev, suSink->GetStorageUnitView(ev), cloneInfo);
  288.     }    
  289. }
  290.  
  291. //----------------------------------------------------------------------------------------
  292. //    CBaseContent::InternalizeProxyList
  293. //----------------------------------------------------------------------------------------
  294.  
  295. void CBaseContent::InternalizeProxyList(Environment* ev,
  296.                                         ODStorageUnit* storageUnit, 
  297.                                         FW_CCloneInfo* cloneInfo)
  298. {
  299.     // ----- Create an archive for our proxies -----
  300.     FW_PStorageUnitSink suSink(ev, storageUnit, kODPropContents, fContainerPart->GetPartKind(ev)->GetType(ev));
  301.     FW_CReadableStream archive(suSink);
  302.     
  303.     // ----- Read number of proxies -----
  304.     unsigned long count;
  305.     archive >> count;
  306.  
  307.     // ----- Read top left offset -----
  308.     FW_CPoint offset;
  309.     archive >> offset.x;
  310.     archive >> offset.y;
  311.  
  312.     FW_CRect frameRect;
  313.     CProxy* proxy;
  314.     for (short i = 0; i<count; i++)
  315.     {
  316.         archive >> frameRect;
  317.         proxy = new CProxy(ev, frameRect, fContainerPart, FW_CPart::fgViewAsFrameToken);
  318.         proxy->Internalize(ev, suSink->GetStorageUnitView(ev), cloneInfo);
  319.         
  320.         // ----- Add the proxy to the proxy list -----
  321.         this->AddProxy(ev, proxy);
  322.  
  323.         // ----- Do whatever else needs to be done to the proxy -----
  324.         this->PostInternalizeProxy(ev, offset, proxy);
  325.     }
  326. }
  327.  
  328. //----------------------------------------------------------------------------------------
  329. //    CBaseContent::IsDataOnlyOneProxy
  330. //----------------------------------------------------------------------------------------
  331.  
  332. FW_MProxy* CBaseContent::IsDataOnlyOneProxy(Environment* ev) const
  333. {
  334. FW_UNUSED(ev);
  335.     if (CountProxies() == 1)
  336.     {
  337.         return (CProxy*)GetFirstProxy();
  338.     }
  339.     
  340.     return NULL;
  341. }
  342.  
  343. //----------------------------------------------------------------------------------------
  344. //    CBaseContent::AddSingleEmbeddedFrame
  345. //----------------------------------------------------------------------------------------
  346.  
  347. CProxy* CBaseContent::AddSingleEmbeddedFrame(Environment* ev, 
  348.                                                   FW_CEmbeddingFrame* scopeFrame,
  349.                                                   ODPart* embeddedPart, 
  350.                                                   ODFrame* embeddedFrame,
  351.                                                   ODShape* suggestedShape,
  352.                                                   ODTypeToken viewType)
  353. {
  354.     // ----- Calculate the default proxy rect -----
  355.     FW_CRect proxyRect;
  356.     if (suggestedShape)
  357.     {
  358.         proxyRect = FW_GetShapeBoundingBox(ev, suggestedShape);
  359.         proxyRect.Offset(-proxyRect.left, -proxyRect.top);
  360.     }
  361.     else
  362.     {
  363.         proxyRect.SetInt(0, 0, 80, 80);
  364.     }
  365.  
  366.     // ----- Calculate the shape of the embedded frame -----    
  367.     FW_CAcquiredODShape aqFrameShape = ::FW_NewODShape(ev, proxyRect);
  368.     
  369.     // ----- Calculate the position of the embedded frame -----
  370.     // ----- We place it in the middle of the content view -----
  371.     FW_CRect frameBounds = scopeFrame->GetContentView(ev)->GetBoundsInContent(ev);
  372.     proxyRect.PlaceInCenterOf(frameBounds);
  373.     
  374.     // ----- Create the proxy -----
  375.     CProxy* proxy = new CProxy(ev, proxyRect, fContainerPart, viewType);
  376.  
  377.     // Make sure that if an exception occurs before we complete this method,
  378.     // we dispose of the proxy
  379.     FW_TRY
  380.     {
  381.         proxy->Embed(ev, 
  382.                     scopeFrame->GetPresentation(ev),
  383.                     embeddedPart, 
  384.                     embeddedFrame,
  385.                     kODFrameObject,    // I want persistent frames
  386.                     aqFrameShape,
  387.                     viewType,
  388.                     NULL,        // no presentation
  389.                     0,            // group id
  390.                     FALSE,        // IsOverlaid
  391.                     FALSE);        // sub-frame
  392.     }
  393.     FW_CATCH_BEGIN
  394.     FW_CATCH_EVERYTHING () {
  395.         // cleanup in case the Embed failed
  396.         delete proxy;
  397.         FW_THROW_SAME ();
  398.     }
  399.     FW_CATCH_END
  400.  
  401.     // ----- Add the proxy to our list -----
  402.     this->AddProxy(ev, proxy);
  403.     
  404.     return proxy;
  405. }
  406.  
  407. //========================================================================================
  408. //    class CContentProxyIterator
  409. //========================================================================================
  410.  
  411. //----------------------------------------------------------------------------------------
  412. //    CContentProxyIterator::CContentProxyIterator
  413. //----------------------------------------------------------------------------------------
  414.  
  415. CContentProxyIterator::CContentProxyIterator(CBaseContent* content) :
  416.     CProxyCollectionIterator(content->fProxyList)
  417. {
  418.     FW_END_CONSTRUCTOR
  419. }
  420.  
  421. //----------------------------------------------------------------------------------------
  422. //    CContentProxyIterator::~CContentProxyIterator
  423. //----------------------------------------------------------------------------------------
  424.  
  425. CContentProxyIterator::~CContentProxyIterator()
  426. {
  427.     FW_START_DESTRUCTOR
  428. }
  429.  
  430. //========================================================================================
  431. //    class CPartContent
  432. //========================================================================================
  433.  
  434. //----------------------------------------------------------------------------------------
  435. //    CPartContent::CPartContent
  436. //----------------------------------------------------------------------------------------
  437. //    CPartContent constructor
  438.  
  439. CPartContent::CPartContent(Environment* ev, CContainerPart* part)
  440. :    CBaseContent(ev, part)
  441. {
  442. }
  443.  
  444. //----------------------------------------------------------------------------------------
  445. //    CPartContent::~CPartContent
  446. //----------------------------------------------------------------------------------------
  447. //    CPartContent destructor
  448.  
  449. CPartContent::~CPartContent()
  450. {
  451.     if (fProxyList)
  452.     {
  453.         CProxy* proxy;
  454.         while ((proxy = fProxyList->First()) != NULL)
  455.         {
  456.             fProxyList->Remove(proxy);
  457.             delete proxy;
  458.         }
  459.     }
  460. }
  461.  
  462. //----------------------------------------------------------------------------------------
  463. //    CPartContent::ExternalizeKind
  464. //----------------------------------------------------------------------------------------
  465.  
  466. void CPartContent::ExternalizeKind(Environment* ev,
  467.                                 ODStorageUnit* storageUnit, 
  468.                                 FW_CKind* kind,
  469.                                 FW_StorageKinds storageKind,
  470.                                 FW_CPromise* promise,
  471.                                 FW_CCloneInfo* cloneInfo)
  472. {
  473. FW_UNUSED(storageKind);
  474. FW_UNUSED(promise);
  475. FW_UNUSED(kind);
  476.     FW_ASSERT(kind->IsPartKind(ev));
  477.     
  478.     ExternalizeProxyList(ev, storageUnit, cloneInfo, FW_kFixed0, FW_kFixed0);
  479. }
  480.  
  481. //----------------------------------------------------------------------------------------
  482. //    CPartContent::Internalize
  483. //----------------------------------------------------------------------------------------
  484.  
  485. FW_Boolean CPartContent::InternalizeKind(Environment* ev,
  486.                                     ODStorageUnit* storageUnit, 
  487.                                     FW_CKind* kind,
  488.                                     FW_StorageKinds storageKind,
  489.                                     FW_CCloneInfo* cloneInfo)
  490. {    
  491. FW_UNUSED(kind);
  492. FW_UNUSED(storageKind);
  493.     InternalizeProxyList(ev, storageUnit, cloneInfo);
  494.     return true;
  495. }
  496.  
  497. //----------------------------------------------------------------------------------------
  498. //    CPartContent::PostInternalizeProxy
  499. //----------------------------------------------------------------------------------------
  500.  
  501. void CPartContent::PostInternalizeProxy(Environment* ev, const FW_CPoint& offset, CProxy* proxy)
  502. {
  503.     proxy->OffsetProxy(ev, -offset.x, -offset.y);
  504. }
  505.  
  506. //========================================================================================
  507. //    class CSelectionContent
  508. //========================================================================================
  509.  
  510. //----------------------------------------------------------------------------------------
  511. //    CSelectionContent::CSelectionContent
  512. //----------------------------------------------------------------------------------------
  513. //    CSelectionContent constructor
  514.  
  515. CSelectionContent::CSelectionContent(Environment* ev, CContainerPart* part, CContainerSelection* selection)
  516. :    CBaseContent(ev, part),
  517.     fContainerSelection(selection)
  518. {
  519. }
  520.  
  521. //----------------------------------------------------------------------------------------
  522. //    CSelectionContent::~CSelectionContent
  523. //----------------------------------------------------------------------------------------
  524. //    CSelectionContent destructor
  525.  
  526. CSelectionContent::~CSelectionContent()
  527. {
  528. }
  529.  
  530. //----------------------------------------------------------------------------------------
  531. //    CSelectionContent::InternalizeKind
  532. //----------------------------------------------------------------------------------------
  533.  
  534. FW_Boolean CSelectionContent::InternalizeKind(Environment* ev,
  535.                                           ODStorageUnit* storageUnit, 
  536.                                           FW_CKind* kind,
  537.                                           FW_StorageKinds storageKind,
  538.                                           FW_CCloneInfo* cloneInfo)
  539. {
  540. FW_UNUSED(kind);
  541. FW_UNUSED(storageKind);
  542.     // ----- Read in the proxies -----
  543.     InternalizeProxyList(ev, storageUnit, cloneInfo);
  544.     
  545.     return true;
  546. }
  547.  
  548. //----------------------------------------------------------------------------------------
  549. //    CSelectionContent::ExternalizeKind
  550. //----------------------------------------------------------------------------------------
  551.  
  552. void CSelectionContent::ExternalizeKind(Environment* ev,
  553.                                     ODStorageUnit* storageUnit, 
  554.                                     FW_CKind* kind,
  555.                                     FW_StorageKinds storageKind,
  556.                                     FW_CPromise* promise,
  557.                                     FW_CCloneInfo* cloneInfo)
  558. {
  559. FW_UNUSED(kind);
  560. FW_UNUSED(storageKind);
  561. FW_UNUSED(promise);
  562.     FW_ASSERT(kind->IsPartKind(ev));
  563.     
  564.     FW_CRect selectRect = fContainerSelection->GetDragRect(ev);
  565.  
  566.     ExternalizeProxyList(ev, storageUnit, cloneInfo, selectRect.left, selectRect.top);
  567. }
  568.  
  569. //----------------------------------------------------------------------------------------
  570. //    CSelectionContent::SingleEmbeddedFrameInternalized
  571. //----------------------------------------------------------------------------------------
  572.  
  573. void CSelectionContent::SingleEmbeddedFrameInternalized(Environment* ev, 
  574.                                                         FW_CEmbeddingFrame* scopeFrame,
  575.                                                         ODPart* embeddedPart, 
  576.                                                         ODFrame* embeddedFrame,
  577.                                                         ODShape* suggestedShape,
  578.                                                         ODTypeToken viewType)
  579. {
  580.     CProxy* insertedProxy = AddSingleEmbeddedFrame(ev, 
  581.                                                         scopeFrame, 
  582.                                                         embeddedPart, 
  583.                                                         embeddedFrame, 
  584.                                                         suggestedShape, 
  585.                                                         viewType);    
  586.     PostInternalizeProxy(ev, FW_kZeroPoint, insertedProxy);                                        
  587. }
  588.  
  589. //----------------------------------------------------------------------------------------
  590. //    CSelectionContent::PostInternalizeProxy
  591. //----------------------------------------------------------------------------------------
  592.  
  593. void CSelectionContent::PostInternalizeProxy(Environment* ev, const FW_CPoint& offset, CProxy* proxy)
  594. {
  595. FW_UNUSED(offset);
  596.     // ----- Add the proxy to the right places -----
  597.     fContainerPart->AddProxyToPart(ev, proxy);    // Add to the part data
  598.     
  599.     // ----- Proxy has already been added to the selection list (fProxyList)
  600.     fContainerSelection->ProxyAdded(ev, proxy);
  601. }
  602.  
  603. //----------------------------------------------------------------------------------------
  604. //    CSelectionContent::AcquireSuggestedFrameShape
  605. //----------------------------------------------------------------------------------------
  606.  
  607. ODShape* CSelectionContent::AcquireSuggestedFrameShape(Environment* ev)
  608. {
  609.     FW_CRect selectionRect = fContainerSelection->GetDragRect(ev);
  610.     selectionRect.Place(FW_kZeroPoint);
  611.     
  612.     return ::FW_NewODShape(ev, selectionRect);
  613. }
  614.  
  615. //========================================================================================
  616. //    class CUndoContent
  617. //========================================================================================
  618.  
  619. //----------------------------------------------------------------------------------------
  620. //    CUndoContent::CUndoContent
  621. //----------------------------------------------------------------------------------------
  622. //    CUndoContent constructor
  623.  
  624. CUndoContent::CUndoContent(Environment* ev, CContainerSelection* selection) :
  625.     CBaseContent(ev, selection->GetSelectionContent(ev)),
  626.     fContainerSelection(selection)
  627. {
  628. }
  629.  
  630. //----------------------------------------------------------------------------------------
  631. //    CUndoContent::~CUndoContent
  632. //----------------------------------------------------------------------------------------
  633. //    CUndoContent destructor
  634.  
  635. CUndoContent::~CUndoContent()
  636. {
  637. }
  638.  
  639. //----------------------------------------------------------------------------------------
  640. //    CUndoContent::RemoveProxySelection
  641. //----------------------------------------------------------------------------------------
  642.  
  643. void CUndoContent::RemoveProxySelection(Environment* ev)
  644. {
  645.     // Select the saved proxies
  646.     fContainerSelection->SelectContent(ev, this);
  647.  
  648.     // Clear the selected proxies
  649.     fContainerSelection->ClearSelection(ev);
  650.  
  651.     // Notify everybody
  652.     fContainerSelection->SelectionChanged(ev);
  653. }
  654.  
  655. //----------------------------------------------------------------------------------------
  656. //    CUndoContent::RestoreProxySelection
  657. //----------------------------------------------------------------------------------------
  658.  
  659. void CUndoContent::RestoreProxySelection(Environment* ev)
  660. {
  661.     // Add the saved proxies back into the part
  662.     CContentProxyIterator ite(this);
  663.     for (CProxy* proxy = ite.First(); ite.IsNotComplete(); proxy = ite.Next())
  664.     {
  665.         fContainerPart->AttachProxy(ev, proxy);
  666.     }
  667.  
  668.     // Redraw the restored proxies
  669.     RedrawProxies(ev);
  670.  
  671.     // Select the saved proxies
  672.     fContainerSelection->SelectContent(ev, this);
  673.  
  674.     // Notify everybody
  675.     fContainerSelection->SelectionChanged(ev);
  676. }
  677.  
  678. //----------------------------------------------------------------------------------------
  679. //    CUndoContent::DeleteSavedProxies
  680. //----------------------------------------------------------------------------------------
  681.  
  682. void CUndoContent::DeleteSavedProxies(Environment* ev)
  683. {
  684.     // ----- Delete all the saved proxies -----
  685.     CProxy* proxy;
  686.     while ((proxy = GetFirstProxy()) != NULL)
  687.     {
  688.         RemoveProxy(ev, proxy);
  689.         delete proxy;
  690.     }        
  691. }
  692.  
  693.